/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.fixedexpense;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.sys.entity.Office;
import com.jeesite.modules.sys.entity.User;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
 * 固定费用项目Entity
 * @author Kilo
 * @version 2021-03-02
 */
@Table(name="t_fixed_expense", alias="a", columns={
		@Column(name="fixed_expense_id", attrName="fixedExpenseId", label="项目编号", isPK=true),
		@Column(name="fixed_expense_name", attrName="fixedExpenseName", label="项目名称", queryType=QueryType.LIKE),
		@Column(name="expense_type", attrName="expenseType", label="费用类别"),
		@Column(name="dept", attrName="office.officeCode", label="所属部门"),
		@Column(name="invoice_category", attrName="invoiceCategory", label="开票类别"),
		@Column(name="remarks", attrName="remarks", label="备注信息", isQuery=false),
		@Column(name="price_method", attrName="priceMethod", label="计价方式"),
		@Column(name="sales_price", attrName="salesPrice", label="标准销售价格", isQuery=false),
		@Column(name="sales_price_ratio", attrName="salesPriceRatio", label="标准销售价格比例", isQuery=false),
		@Column(name="purchase_price", attrName="purchasePrice", label="标准采购价格", isQuery=false),
		@Column(name="purchase_price_ratio", attrName="purchasePriceRatio", label="标准采购价格比例", isQuery=false),
		@Column(name="create_by", attrName="createBy", label="创建者"),
		@Column(name="create_date", attrName="createDate", label="创建时间"),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="ap_account", attrName="apAccount", label="应付账款科目"),
		@Column(name="ar_account", attrName="arAccount", label="应收账款科目"),
		@Column(name="pre_ap_account", attrName="preApAccount", label="预付账款科目"),
		@Column(name="pre_ar_account", attrName="preArAccount", label="预收账款科目"),
		@Column(name="cost_account", attrName="costAccount", label="成本科目"),
		@Column(name="income_account", attrName="incomeAccount", label="收入科目"),
	}, joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= Office.class, attrName="office", alias="u11",
				on="u11.office_code = a.dept", columns={
				@Column(name="office_code", label="部门编码", isPK=true),
				@Column(name="office_name", label="部门名称", isQuery=false),
		}),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "createByUser", alias = "createby",
                on = "createby.user_code = a.create_by", columns = {
                @Column(name = "user_code", label = "用户编码", isPK = true),
                @Column(name = "user_name", label = "用户名称", isQuery = false),
        }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "updateByUser", alias = "updateby",
                on = "updateby.user_code = a.update_by", columns = {
                @Column(name = "user_code", label = "用户编码", isPK = true),
                @Column(name = "user_name", label = "用户名称", isQuery = false),
        }),
	}, orderBy="a.update_date DESC"
)
public class FixedExpense extends DataEntity<FixedExpense> {
	
	private static final long serialVersionUID = 1L;
	private String fixedExpenseId;		// 项目编号
	private String fixedExpenseName;		// 项目名称
	private String expenseType;		// 费用类别
	private String dept;		// 所属部门
	private String invoiceCategory;		// 开票类别
	private String priceMethod;		// 计价方式
	private Double salesPrice;		// 标准销售价格
	private String salesPriceRatio;		// 标准销售价格比例
	private Double purchasePrice;		// 标准采购价格
	private String purchasePriceRatio;		// 标准采购价格比例
	private List<CurrencyLadderPrice> currencyLadderPriceList = ListUtils.newArrayList();		// 子表列表
	private List<LadderPrice> ladderPriceList = ListUtils.newArrayList();		// 子表列表
	private List<CustomerPrice> customerPriceList = ListUtils.newArrayList();		// 子表列表
	private List<SupplierPrice> supplierPriceList = ListUtils.newArrayList();		// 子表列表
	private List<VehicleSettlementInfo> vehicleSettlementInfoList = ListUtils.newArrayList();		// 子表列表
	private Office office;		// 部门选择
	private String apAccount;
	private String arAccount;
	private String preApAccount;
	private String preArAccount;
	private String costAccount;
	private String incomeAccount;
    private User createByUser;
    private User updateByUser;

	public String getApAccount() {
		return apAccount;
	}

	public void setApAccount(String apAccount) {
		this.apAccount = apAccount;
	}

	public String getArAccount() {
		return arAccount;
	}

	public void setArAccount(String arAccount) {
		this.arAccount = arAccount;
	}

	public String getPreApAccount() {
		return preApAccount;
	}

	public void setPreApAccount(String preApAccount) {
		this.preApAccount = preApAccount;
	}

	public String getPreArAccount() {
		return preArAccount;
	}

	public void setPreArAccount(String preArAccount) {
		this.preArAccount = preArAccount;
	}

	public String getCostAccount() {
		return costAccount;
	}

	public void setCostAccount(String costAccount) {
		this.costAccount = costAccount;
	}

	public String getIncomeAccount() {
		return incomeAccount;
	}

	public void setIncomeAccount(String incomeAccount) {
		this.incomeAccount = incomeAccount;
	}

	public FixedExpense() {
		this(null);
	}

	public FixedExpense(String id){
		super(id);
	}
	
	public String getFixedExpenseId() {
		return fixedExpenseId;
	}

	public void setFixedExpenseId(String fixedExpenseId) {
		this.fixedExpenseId = fixedExpenseId;
	}
	
	@NotBlank(message="项目名称不能为空")
	@Length(min=0, max=100, message="项目名称长度不能超过 100 个字符")
	public String getFixedExpenseName() {
		return fixedExpenseName;
	}

	public void setFixedExpenseName(String fixedExpenseName) {
		this.fixedExpenseName = fixedExpenseName;
	}
	
	@NotBlank(message="费用类别不能为空")
	@Length(min=0, max=2, message="费用类别长度不能超过 2 个字符")
	public String getExpenseType() {
		return expenseType;
	}

	public void setExpenseType(String expenseType) {
		this.expenseType = expenseType;
	}
	
	@Length(min=0, max=64, message="所属部门长度不能超过 64 个字符")
	public String getDept() {
		return dept;
	}

	public void setDept(String dept) {
		this.dept = dept;
	}
	
	@NotBlank(message="开票类别不能为空")
	@Length(min=0, max=2, message="开票类别长度不能超过 2 个字符")
	public String getInvoiceCategory() {
		return invoiceCategory;
	}

	public void setInvoiceCategory(String invoiceCategory) {
		this.invoiceCategory = invoiceCategory;
	}
	
	@NotBlank(message="计价方式不能为空")
	@Length(min=0, max=2, message="计价方式长度不能超过 2 个字符")
	public String getPriceMethod() {
		return priceMethod;
	}

	public void setPriceMethod(String priceMethod) {
		this.priceMethod = priceMethod;
	}
	
	public Double getSalesPrice() {
		return salesPrice;
	}

	public void setSalesPrice(Double salesPrice) {
		this.salesPrice = salesPrice;
	}
	
	@Length(min=0, max=10, message="标准销售价格比例长度不能超过 10 个字符")
	public String getSalesPriceRatio() {
		return salesPriceRatio;
	}

	public void setSalesPriceRatio(String salesPriceRatio) {
		this.salesPriceRatio = salesPriceRatio;
	}
	
	public Double getPurchasePrice() {
		return purchasePrice;
	}

	public void setPurchasePrice(Double purchasePrice) {
		this.purchasePrice = purchasePrice;
	}
	
	@Length(min=0, max=10, message="标准采购价格比例长度不能超过 10 个字符")
	public String getPurchasePriceRatio() {
		return purchasePriceRatio;
	}

	public void setPurchasePriceRatio(String purchasePriceRatio) {
		this.purchasePriceRatio = purchasePriceRatio;
	}
	
	public List<CurrencyLadderPrice> getCurrencyLadderPriceList() {
		return currencyLadderPriceList;
	}

	public void setCurrencyLadderPriceList(List<CurrencyLadderPrice> currencyLadderPriceList) {
		this.currencyLadderPriceList = currencyLadderPriceList;
	}
	
	public List<LadderPrice> getLadderPriceList() {
		return ladderPriceList;
	}

	public void setLadderPriceList(List<LadderPrice> ladderPriceList) {
		this.ladderPriceList = ladderPriceList;
	}
	
	public List<CustomerPrice> getCustomerPriceList() {
		return customerPriceList;
	}

	public void setCustomerPriceList(List<CustomerPrice> customerPriceList) {
		this.customerPriceList = customerPriceList;
	}
	
	public List<SupplierPrice> getSupplierPriceList() {
		return supplierPriceList;
	}

	public void setSupplierPriceList(List<SupplierPrice> supplierPriceList) {
		this.supplierPriceList = supplierPriceList;
	}
	
	public List<VehicleSettlementInfo> getVehicleSettlementInfoList() {
		return vehicleSettlementInfoList;
	}

	public void setVehicleSettlementInfoList(List<VehicleSettlementInfo> vehicleSettlementInfoList) {
		this.vehicleSettlementInfoList = vehicleSettlementInfoList;
	}

	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}

	public Date getCreateDate_gte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
	}

	public void setCreateDate_gte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
	}

	public Date getCreateDate_lte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
	}

	public void setCreateDate_lte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
	}

    public User getCreateByUser() {
        return createByUser;
    }

    public void setCreateByUser(User createByUser) {
        this.createByUser = createByUser;
    }

    public User getUpdateByUser() {
        return updateByUser;
    }

    public void setUpdateByUser(User updateByUser) {
        this.updateByUser = updateByUser;
    }
}